/**
 * 角色相关请求模块
 */
import request from '@/utils/request'

// 按条件查询角色
export const getRoles = (data: any) => {
    return request({
        method: 'POST',
        url: '/boss/role/getRolePages',
        data
    })
}

// 删除角色
export const deteleRoles = (id: string | number) => {
    return request({
        method: 'DELETE',
        url: `/boss/role/${id}`
    })
}

// 保存或者更新角色
export const createOrUpdateRoles = (data: any) => {
    return request({
        method: 'POST',
        url: '/boss/role/saveOrUpdate',
        data
    })
}

// 获取角色
export const getRoleById = (id: string | number) => {
    return request({
        method: 'GET',
        url: `/boss/role/${id}`
    })
}

// 获取所有角色
export const getAllRoles = () => {
    return request({
        method: 'GET',
        url: '/boss/role/all'
    })
}

//给用户分配角色
export const getAllocateUserRoles = (data: any) => {
    return request({
        method: 'POST',
        url: '/boss/role/allocateUserRoles',
        data
    })
}

// 查询用户角色
export const getUserRoles = (userId: string | number) => {
    return request({
        method: 'GET',
        url: `/boss/role/user/${userId}`
    })
}